/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utils;

import java.io.Serializable;

/**
 *
 * @author gurgel
 */
public class BaseModel implements Serializable, IBaseModel, Comparable<Object> {

    private int id;
    private String name;
    private String code;

    @Override
    public String getComboId() {
        return this.code;
    }

    @Override
    public String getComboDisplay() {
        return this.name;
    }

    @Override
    public String toString() {
        return this.getName() + "-" + getClass().getName() + "@" + Integer.toHexString(hashCode());
    }

    @Override
    public int compareTo(Object o) {
        BaseModel outro = (BaseModel) o;
        return (this.getCode().compareToIgnoreCase(outro.getCode()));
    }

    /**
     * @return the id
     */
    @Override
    public int getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * @return the name
     */
    @Override
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the code
     */
    @Override
    public String getCode() {
        return code;
    }

    /**
     * @param code the code to set
     */
    public void setCode(String code) {
        this.code = code;
    }
}
